<?php

namespace app\common\model\xilumarket;

use think\Model;
use traits\model\SoftDelete;

class TopicBanUser extends Model
{
    use SoftDelete;
    protected $name = 'xilumarket_topic_ban_user';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = 'deletetime';

    protected $append = [
        'expir_time_text'
    ];


    public function getExpirTimeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['expir_time']) ? $data['expir_time'] : '');
        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
    }
}
